﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace 表白程序
{
    public partial class Form2 : Form
    {
        Random r;
        int flag;

        public Form2()
        {
            InitializeComponent();
            r = new Random();
            flag = 0;
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            int widht = this.ClientRectangle.Width - no_button.Width;
            int hight = this.ClientRectangle.Height - no_button.Height;
            no_button.Left = r.Next(0, widht);
            no_button.Top = r.Next(0, hight);
            
        }

        private void textBox_KeyUp(object sender, KeyEventArgs e)
        {
            textBox.Text = "我愿意";
            textBox.Select(textBox.Text.Length, 0);
        }

        private void ok_button_Click(object sender, EventArgs e)
        {
            //this.Close();
            flag = 1;
            this.Visible = false;
            Form3 form3 = new Form3();
            form3.ShowDialog();
            
        }

        private void no_button_Click(object sender, EventArgs e)
        {
            Form4 form4 = new Form4();
            form4.ShowDialog();
        }

        private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {
            if(flag == 0)
            {
                Form4 form4 = new Form4();
                form4.ShowDialog();
                e.Cancel = true;
            }  
        }
    }
}
